/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author machine
 */
@Stateless
public class IdiomasFacade extends AbstractFacade<Idiomas> implements IdiomasFacadeLocal {
    @PersistenceContext(unitName = "videosJEE-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public IdiomasFacade() {
        super(Idiomas.class);
    }

    @Override
    public Idiomas consultarIdioma(String idioma) {
        Query q = em.createQuery( "SELECT i FROM Idiomas i WHERE i.ididiomas = " + idioma + " " );
        //q.setParameter("idcateg", Integer.getInteger("1"));
        
        return (Idiomas) q.getSingleResult();
    }
    
}
